import java.util.*;

/**
 * @Author Kechelle
 * @Date 2020/9/12 14:14
 * @Version 1.0
 */
public class Test {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        System.out.println(function(str));
    }

    public static int function(String str){
        char[] chars = str.toCharArray();
        int[] nums = new int[6];
        for (int i=0;i<chars.length;i++){
            if (chars[i] == 'a') nums[0]++;
            if (chars[i] == 'b') nums[1]++;
            if (chars[i] == 'c') nums[2]++;
            if (chars[i] == 'x') nums[3]++;
            if (chars[i] == 'y') nums[4]++;
            if (chars[i] == 'z') nums[5]++;
        }
        int max = 0;
        int location = 0;

        for (int num:nums){
            if (num%2==0)
                max = Math.max(max,num);
        }
        for (int i=0;i<nums.length;i++){
            if (nums[i] == max){
                location = i;
            }
        }
        switch (location){
            case 0:
                return str.lastIndexOf("a")+1;
            case 1:
                return str.lastIndexOf("b")+1;
            case 2:
                return str.lastIndexOf("c")+1;
            case 3:
                return str.lastIndexOf("x")+1;
            case 4:
                return str.lastIndexOf("y")+1;
            case 5:
                return str.lastIndexOf("z")+1;
            default:
                return 0;
        }
    }
}
